#ifndef _INT_HASH_MAP_H_
#define _INT_HASH_MAP_H_


#include "intrbtree.h"
#include <string.h>
#include<tools/lb_memory.h>
// typedef struct Int_Hash_Map_Node{
//     int key,hash_key;
//     void* value;
// }Int_Hash_Map_Node;
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */


typedef struct Int_Hash_Map{
    Int_RB_Tree**values;
    int container_size;
    int size;
    void* (*find)(struct Int_Hash_Map*,int);
    int (*insert)(struct Int_Hash_Map*,int key,void* data);

    int (*erase)(struct Int_Hash_Map*,int key);

    struct Int_Hash_Map_Trav ( *begin ) ( struct Int_Hash_Map* );
    struct Int_Hash_Map_Trav ( *rbegin ) ( struct Int_Hash_Map* );
    void* prop;
}Int_Hash_Map;


//默认 10
// static inline void int_hash_map_initn(Int_Hash_Map* ihm,int size)
// {
//     ihm->size=size;
//     ihm->values=(Int_RB_Tree**)LB_MALLOC(sizeof(Int_RB_Tree*)*size);
//     memset(ihm->values,0,sizeof(Int_RB_Tree*)*size);
// }

// static inline void int_hash_map_init(Int_Hash_Map* ihm)
// {
//     int_hash_map_initn(Int_Hash_Map* ihm,int size)
// }
void int_hash_map_free(Int_Hash_Map* ihm);


typedef struct Int_Hash_Map_Trav {
    struct Int_Hash_Map* ihm;
    int current_index;
    Int_RB_Tree_Trav current_trav;
    Int_RB_Tree_Node* it;
    void (*next)(struct Int_Hash_Map_Trav*);
    void (*prev)(struct Int_Hash_Map_Trav*);
    void* second;
    int first;
    void* prop;
} Int_Hash_Map_Trav;





void int_hash_map_init(Int_Hash_Map* ihm, int size);

void int_hash_map_resize(Int_Hash_Map* ihm, int size);
//2707 647


#ifdef __cplusplus
} // extern "C"
#endif /* __cplusplus */



#endif